<!DOCTYPE html>
<html>
<head>
<title>API-使用文档.md</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">

<style>
/* https://github.com/microsoft/vscode/blob/master/extensions/markdown-language-features/media/markdown.css */
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

body {
	font-family: var(--vscode-markdown-font-family, -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif);
	font-size: var(--vscode-markdown-font-size, 14px);
	padding: 0 26px;
	line-height: var(--vscode-markdown-line-height, 22px);
	word-wrap: break-word;
}

#code-csp-warning {
	position: fixed;
	top: 0;
	right: 0;
	color: white;
	margin: 16px;
	text-align: center;
	font-size: 12px;
	font-family: sans-serif;
	background-color:#444444;
	cursor: pointer;
	padding: 6px;
	box-shadow: 1px 1px 1px rgba(0,0,0,.25);
}

#code-csp-warning:hover {
	text-decoration: none;
	background-color:#007acc;
	box-shadow: 2px 2px 2px rgba(0,0,0,.25);
}

body.scrollBeyondLastLine {
	margin-bottom: calc(100vh - 22px);
}

body.showEditorSelection .code-line {
	position: relative;
}

body.showEditorSelection .code-active-line:before,
body.showEditorSelection .code-line:hover:before {
	content: "";
	display: block;
	position: absolute;
	top: 0;
	left: -12px;
	height: 100%;
}

body.showEditorSelection li.code-active-line:before,
body.showEditorSelection li.code-line:hover:before {
	left: -30px;
}

.vscode-light.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(0, 0, 0, 0.15);
}

.vscode-light.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(0, 0, 0, 0.40);
}

.vscode-light.showEditorSelection .code-line .code-line:hover:before {
	border-left: none;
}

.vscode-dark.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(255, 255, 255, 0.4);
}

.vscode-dark.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(255, 255, 255, 0.60);
}

.vscode-dark.showEditorSelection .code-line .code-line:hover:before {
	border-left: none;
}

.vscode-high-contrast.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(255, 160, 0, 0.7);
}

.vscode-high-contrast.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(255, 160, 0, 1);
}

.vscode-high-contrast.showEditorSelection .code-line .code-line:hover:before {
	border-left: none;
}

img {
	max-width: 100%;
	max-height: 100%;
}

a {
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 1px solid -webkit-focus-ring-color;
	outline-offset: -1px;
}

hr {
	border: 0;
	height: 2px;
	border-bottom: 2px solid;
}

h1 {
	padding-bottom: 0.3em;
	line-height: 1.2;
	border-bottom-width: 1px;
	border-bottom-style: solid;
}

h1, h2, h3 {
	font-weight: normal;
}

table {
	border-collapse: collapse;
}

table > thead > tr > th {
	text-align: left;
	border-bottom: 1px solid;
}

table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td {
	padding: 5px 10px;
}

table > tbody > tr + tr > td {
	border-top: 1px solid;
}

blockquote {
	margin: 0 7px 0 5px;
	padding: 0 16px 0 10px;
	border-left-width: 5px;
	border-left-style: solid;
}

code {
	font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
	font-size: 1em;
	line-height: 1.357em;
}

body.wordWrap pre {
	white-space: pre-wrap;
}

pre:not(.hljs),
pre.hljs code > div {
	padding: 16px;
	border-radius: 3px;
	overflow: auto;
}

pre code {
	color: var(--vscode-editor-foreground);
	tab-size: 4;
}

/** Theming */

.vscode-light pre {
	background-color: rgba(220, 220, 220, 0.4);
}

.vscode-dark pre {
	background-color: rgba(10, 10, 10, 0.4);
}

.vscode-high-contrast pre {
	background-color: rgb(0, 0, 0);
}

.vscode-high-contrast h1 {
	border-color: rgb(0, 0, 0);
}

.vscode-light table > thead > tr > th {
	border-color: rgba(0, 0, 0, 0.69);
}

.vscode-dark table > thead > tr > th {
	border-color: rgba(255, 255, 255, 0.69);
}

.vscode-light h1,
.vscode-light hr,
.vscode-light table > tbody > tr + tr > td {
	border-color: rgba(0, 0, 0, 0.18);
}

.vscode-dark h1,
.vscode-dark hr,
.vscode-dark table > tbody > tr + tr > td {
	border-color: rgba(255, 255, 255, 0.18);
}

</style>

<style>
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */

/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
	color: #8e908c;
}

/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
	color: #c82829;
}

/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
	color: #f5871f;
}

/* Tomorrow Yellow */
.hljs-attribute {
	color: #eab700;
}

/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
	color: #718c00;
}

/* Tomorrow Blue */
.hljs-title,
.hljs-section {
	color: #4271ae;
}

/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
	color: #8959a8;
}

.hljs {
	display: block;
	overflow-x: auto;
	color: #4d4d4c;
	padding: 0.5em;
}

.hljs-emphasis {
	font-style: italic;
}

.hljs-strong {
	font-weight: bold;
}
</style>

<style>
/*
 * Markdown PDF CSS
 */

 body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif, "Meiryo";
	padding: 0 12px;
}

pre {
	background-color: #f8f8f8;
	border: 1px solid #cccccc;
	border-radius: 3px;
	overflow-x: auto;
	white-space: pre-wrap;
	overflow-wrap: break-word;
}

pre:not(.hljs) {
	padding: 23px;
	line-height: 19px;
}

blockquote {
	background: rgba(127, 127, 127, 0.1);
	border-color: rgba(0, 122, 204, 0.5);
}

.emoji {
	height: 1.4em;
}

code {
	font-size: 14px;
	line-height: 19px;
}

/* for inline code */
:not(pre):not(.hljs) > code {
	color: #C9AE75; /* Change the old color so it seems less like an error */
	font-size: inherit;
}

/* Page Break : use <div class="page"/> to insert page break
-------------------------------------------------------- */
.page {
	page-break-after: always;
}

</style>

<script src="https://unpkg.com/mermaid/dist/mermaid.min.js"></script>
</head>
<body>
  <script>
    mermaid.initialize({
      startOnLoad: true,
      theme: document.body.classList.contains('vscode-dark') || document.body.classList.contains('vscode-high-contrast')
          ? 'dark'
          : 'default'
    });
  </script>
<h1 id="weather-main-service-api-%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3">Weather Main Service API 使用文档</h1>
<p>本文档详细介绍了Weather Main Service的API接口使用方法，以及如何使用Postman进行测试。</p>
<h2 id="%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF">基本信息</h2>
<ul>
<li>基础URL: <code>http://localhost:9090/api/weather</code></li>
<li>所有接口返回的数据结构统一为：</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,      <span class="hljs-comment">// 状态码：200成功，其他为失败</span>
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,  <span class="hljs-comment">// 是否成功：true成功，false失败</span>
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>, <span class="hljs-comment">// 消息</span>
  <span class="hljs-attr">"data"</span>: {         <span class="hljs-comment">// 数据（具体结构根据接口不同而变化）</span>
    <span class="hljs-comment">// 返回的具体数据</span>
  }
}
</div></code></pre>
<h2 id="%E6%8E%A5%E5%8F%A3%E5%88%97%E8%A1%A8">接口列表</h2>
<h3 id="1-%E8%8E%B7%E5%8F%96%E5%9F%8E%E5%B8%82%E5%BD%93%E5%89%8D%E5%A4%A9%E6%B0%94">1. 获取城市当前天气</h3>
<ul>
<li><strong>接口</strong>：<code>GET /current/{cityCode}</code></li>
<li><strong>描述</strong>：获取指定城市的当前天气信息</li>
<li><strong>参数</strong>：
<ul>
<li><code>cityCode</code>：城市代码，路径参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/current/BJ</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: {
    <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
    <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
    <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
    <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
    <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
    <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
    <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
    <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
    <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
  }
}
</div></code></pre>
<h3 id="2-%E8%8E%B7%E5%8F%96%E6%89%80%E6%9C%89%E5%9F%8E%E5%B8%82%E5%BD%93%E5%89%8D%E5%A4%A9%E6%B0%94">2. 获取所有城市当前天气</h3>
<ul>
<li><strong>接口</strong>：<code>GET /current</code></li>
<li><strong>描述</strong>：获取所有城市的当前天气信息</li>
<li><strong>参数</strong>：无</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/current</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="3-%E8%8E%B7%E5%8F%96%E5%9F%8E%E5%B8%82%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5">3. 获取城市天气预报</h3>
<ul>
<li><strong>接口</strong>：<code>GET /forecast/{cityCode}</code></li>
<li><strong>描述</strong>：获取指定城市的天气预报</li>
<li><strong>参数</strong>：
<ul>
<li><code>cityCode</code>：城市代码，路径参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/forecast/BJ</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"forecastDate"</span>: <span class="hljs-string">"2025-06-07"</span>,
      <span class="hljs-attr">"temperatureMin"</span>: <span class="hljs-number">20.0</span>,
      <span class="hljs-attr">"temperatureMax"</span>: <span class="hljs-number">28.0</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.0</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多天气预报...</span>
  ]
}
</div></code></pre>
<h3 id="4-%E8%8E%B7%E5%8F%96%E5%9F%8E%E5%B8%82%E5%A4%A9%E6%B0%94%E8%AD%A6%E6%8A%A5">4. 获取城市天气警报</h3>
<ul>
<li><strong>接口</strong>：<code>GET /alert/{cityCode}</code></li>
<li><strong>描述</strong>：获取指定城市的天气警报</li>
<li><strong>参数</strong>：
<ul>
<li><code>cityCode</code>：城市代码，路径参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/alert/BJ</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"alertType"</span>: <span class="hljs-string">"高温"</span>,
      <span class="hljs-attr">"alertLevel"</span>: <span class="hljs-string">"黄色"</span>,
      <span class="hljs-attr">"alertContent"</span>: <span class="hljs-string">"预计未来24小时内最高气温将升至35℃以上，请注意防暑降温。"</span>,
      <span class="hljs-attr">"startTime"</span>: <span class="hljs-string">"2025-06-06 10:00:00"</span>,
      <span class="hljs-attr">"endTime"</span>: <span class="hljs-string">"2025-06-07 10:00:00"</span>,
      <span class="hljs-attr">"isActive"</span>: <span class="hljs-literal">true</span>,
      <span class="hljs-attr">"createTime"</span>: <span class="hljs-string">"2025-06-06 08:00:00"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 08:00:00"</span>
    }
  ]
}
</div></code></pre>
<h3 id="5-%E8%8E%B7%E5%8F%96%E5%9F%8E%E5%B8%82%E6%89%80%E6%9C%89%E5%A4%A9%E6%B0%94%E4%BF%A1%E6%81%AF">5. 获取城市所有天气信息</h3>
<ul>
<li><strong>接口</strong>：<code>GET /all/{cityCode}</code></li>
<li><strong>描述</strong>：获取指定城市的所有天气信息，包括当前天气、天气预报和天气警报</li>
<li><strong>参数</strong>：
<ul>
<li><code>cityCode</code>：城市代码，路径参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/all/BJ</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: {
    <span class="hljs-attr">"current"</span>: {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-attr">"forecast"</span>: [
      <span class="hljs-comment">// 天气预报数据...</span>
    ],
    <span class="hljs-attr">"alerts"</span>: [
      <span class="hljs-comment">// 天气警报数据...</span>
    ]
  }
}
</div></code></pre>
<h3 id="6-%E8%8E%B7%E5%8F%96%E6%89%80%E6%9C%89%E5%9F%8E%E5%B8%82%E4%BB%A3%E7%A0%81%E5%92%8C%E5%90%8D%E7%A7%B0">6. 获取所有城市代码和名称</h3>
<ul>
<li><strong>接口</strong>：<code>GET /cities</code></li>
<li><strong>描述</strong>：获取所有城市的代码和名称</li>
<li><strong>参数</strong>：无</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/cities</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"code"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"北京"</span>
    },
    {
      <span class="hljs-attr">"code"</span>: <span class="hljs-string">"SH"</span>,
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"上海"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="7-%E6%A0%B9%E6%8D%AE%E5%9F%8E%E5%B8%82%E5%90%8D%E7%A7%B0%E6%90%9C%E7%B4%A2">7. 根据城市名称搜索</h3>
<ul>
<li><strong>接口</strong>：<code>GET /search</code></li>
<li><strong>描述</strong>：根据城市名称进行模糊搜索</li>
<li><strong>参数</strong>：
<ul>
<li><code>name</code>：城市名称，查询参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/search?name=北</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    }
  ]
}
</div></code></pre>
<h3 id="8-%E8%8E%B7%E5%8F%96%E5%A4%A9%E6%B0%94%E7%BB%9F%E8%AE%A1%E4%BF%A1%E6%81%AF">8. 获取天气统计信息</h3>
<ul>
<li><strong>接口</strong>：<code>GET /statistics</code></li>
<li><strong>描述</strong>：获取天气相关的统计信息</li>
<li><strong>参数</strong>：无</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/statistics</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: {
    <span class="hljs-attr">"cityCount"</span>: <span class="hljs-number">20</span>,
    <span class="hljs-attr">"alertCount"</span>: <span class="hljs-number">5</span>
  }
}
</div></code></pre>
<h3 id="9-%E8%8E%B7%E5%8F%96%E7%83%AD%E9%97%A8%E5%9F%8E%E5%B8%82%E5%A4%A9%E6%B0%94">9. 获取热门城市天气</h3>
<ul>
<li><strong>接口</strong>：<code>GET /hot-cities</code></li>
<li><strong>描述</strong>：获取温度最高的5个城市的天气信息</li>
<li><strong>参数</strong>：无</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/hot-cities</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">3</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"GZ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"广州"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">32.0</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">80.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">2.5</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"多云"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="10-%E8%8E%B7%E5%8F%96%E6%9C%80%E5%86%B7%E5%9F%8E%E5%B8%82%E5%A4%A9%E6%B0%94">10. 获取最冷城市天气</h3>
<ul>
<li><strong>接口</strong>：<code>GET /cold-cities</code></li>
<li><strong>描述</strong>：获取温度最低的5个城市的天气信息</li>
<li><strong>参数</strong>：无</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/cold-cities</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">17</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"HEB"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"哈尔滨"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">18.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.0</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东北风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"多云"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="11-%E8%8E%B7%E5%8F%96%E7%89%B9%E5%AE%9A%E6%B8%A9%E5%BA%A6%E8%8C%83%E5%9B%B4%E5%86%85%E7%9A%84%E5%9F%8E%E5%B8%82">11. 获取特定温度范围内的城市</h3>
<ul>
<li><strong>接口</strong>：<code>GET /temperature-range</code></li>
<li><strong>描述</strong>：获取指定温度范围内的城市天气信息</li>
<li><strong>参数</strong>：
<ul>
<li><code>minTemp</code>：最低温度，查询参数</li>
<li><code>maxTemp</code>：最高温度，查询参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/temperature-range?minTemp=25&amp;maxTemp=30</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="12-%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F%E7%9A%84%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5">12. 获取指定日期的天气预报</h3>
<ul>
<li><strong>接口</strong>：<code>GET /forecast/date/{cityCode}</code></li>
<li><strong>描述</strong>：获取指定城市指定日期的天气预报</li>
<li><strong>参数</strong>：
<ul>
<li><code>cityCode</code>：城市代码，路径参数</li>
<li><code>date</code>：预报日期(yyyy-MM-dd)，查询参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/forecast/date/BJ?date=2025-06-07</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: {
    <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
    <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
    <span class="hljs-attr">"forecastDate"</span>: <span class="hljs-string">"2025-06-07"</span>,
    <span class="hljs-attr">"temperatureMin"</span>: <span class="hljs-number">20.0</span>,
    <span class="hljs-attr">"temperatureMax"</span>: <span class="hljs-number">28.0</span>,
    <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
    <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.0</span>,
    <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
    <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
    <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
  }
}
</div></code></pre>
<h3 id="13-%E8%8E%B7%E5%8F%96%E7%89%B9%E5%AE%9A%E5%A4%A9%E6%B0%94%E7%8A%B6%E5%86%B5%E7%9A%84%E5%9F%8E%E5%B8%82">13. 获取特定天气状况的城市</h3>
<ul>
<li><strong>接口</strong>：<code>GET /weather-condition/{condition}</code></li>
<li><strong>描述</strong>：获取符合特定天气状况的城市</li>
<li><strong>参数</strong>：
<ul>
<li><code>condition</code>：天气状况(如：晴、多云、雨等)，路径参数</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>GET http://localhost:9090/api/weather/weather-condition/晴</code></li>
<li>响应：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: [
    {
      <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
      <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
      <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
      <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
      <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
      <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
      <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
      <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
      <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
    },
    <span class="hljs-comment">// 更多城市...</span>
  ]
}
</div></code></pre>
<h3 id="14-%E6%AF%94%E8%BE%83%E5%A4%9A%E4%B8%AA%E5%9F%8E%E5%B8%82%E7%9A%84%E5%A4%A9%E6%B0%94">14. 比较多个城市的天气</h3>
<ul>
<li><strong>接口</strong>：<code>POST /compare</code></li>
<li><strong>描述</strong>：比较多个城市的天气信息</li>
<li><strong>参数</strong>：
<ul>
<li>请求体：城市代码列表</li>
</ul>
</li>
<li><strong>示例</strong>：
<ul>
<li>请求：<code>POST http://localhost:9090/api/weather/compare</code></li>
<li>请求体：</li>
</ul>
</li>
</ul>
<pre class="hljs"><code><div>[<span class="hljs-string">"BJ"</span>, <span class="hljs-string">"SH"</span>, <span class="hljs-string">"GZ"</span>]
</div></code></pre>
<ul>
<li>响应：</li>
</ul>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"code"</span>: <span class="hljs-number">200</span>,
  <span class="hljs-attr">"success"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"message"</span>: <span class="hljs-string">"操作成功"</span>,
  <span class="hljs-attr">"data"</span>: {
    <span class="hljs-attr">"cities"</span>: [
      {
        <span class="hljs-attr">"id"</span>: <span class="hljs-number">1</span>,
        <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"BJ"</span>,
        <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"北京"</span>,
        <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">25.5</span>,
        <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">45.0</span>,
        <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.2</span>,
        <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
        <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"晴"</span>,
        <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
      },
      {
        <span class="hljs-attr">"id"</span>: <span class="hljs-number">2</span>,
        <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"SH"</span>,
        <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"上海"</span>,
        <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">28.0</span>,
        <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">70.0</span>,
        <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">3.8</span>,
        <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东风"</span>,
        <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"多云"</span>,
        <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
      },
      {
        <span class="hljs-attr">"id"</span>: <span class="hljs-number">3</span>,
        <span class="hljs-attr">"cityCode"</span>: <span class="hljs-string">"GZ"</span>,
        <span class="hljs-attr">"cityName"</span>: <span class="hljs-string">"广州"</span>,
        <span class="hljs-attr">"temperature"</span>: <span class="hljs-number">32.0</span>,
        <span class="hljs-attr">"humidity"</span>: <span class="hljs-number">80.0</span>,
        <span class="hljs-attr">"windSpeed"</span>: <span class="hljs-number">2.5</span>,
        <span class="hljs-attr">"windDirection"</span>: <span class="hljs-string">"东南风"</span>,
        <span class="hljs-attr">"weatherCondition"</span>: <span class="hljs-string">"多云"</span>,
        <span class="hljs-attr">"updateTime"</span>: <span class="hljs-string">"2025-06-06 19:19:34"</span>
      }
    ]
  }
}
</div></code></pre>
<h2 id="postman-%E6%B5%8B%E8%AF%95%E6%AD%A5%E9%AA%A4">Postman 测试步骤</h2>
<ol>
<li><strong>导入接口集合</strong>：
<ul>
<li>打开Postman</li>
<li>点击左上角的&quot;Import&quot;按钮</li>
<li>选择&quot;Raw text&quot;选项卡</li>
<li>复制以下JSON内容并粘贴，然后点击&quot;Import&quot;：</li>
</ul>
</li>
</ol>
<pre class="hljs"><code><div>{
  <span class="hljs-attr">"info"</span>: {
    <span class="hljs-attr">"name"</span>: <span class="hljs-string">"Weather Main Service API"</span>,
    <span class="hljs-attr">"_postman_id"</span>: <span class="hljs-string">"weather-main-service-api-collection"</span>,
    <span class="hljs-attr">"description"</span>: <span class="hljs-string">"接口测试集合"</span>,
    <span class="hljs-attr">"schema"</span>: <span class="hljs-string">"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"</span>
  },
  <span class="hljs-attr">"item"</span>: [
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取城市当前天气"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/current/BJ"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"current"</span>, <span class="hljs-string">"BJ"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取所有城市当前天气"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/current"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"current"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取城市天气预报"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/forecast/BJ"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"forecast"</span>, <span class="hljs-string">"BJ"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取城市天气警报"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/alert/BJ"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"alert"</span>, <span class="hljs-string">"BJ"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取城市所有天气信息"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/all/BJ"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"all"</span>, <span class="hljs-string">"BJ"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取所有城市代码和名称"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/cities"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"cities"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"根据城市名称搜索"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/search?name=北"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"search"</span>],
          <span class="hljs-attr">"query"</span>: [
            {
              <span class="hljs-attr">"key"</span>: <span class="hljs-string">"name"</span>,
              <span class="hljs-attr">"value"</span>: <span class="hljs-string">"北"</span>
            }
          ]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取天气统计信息"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/statistics"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"statistics"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取热门城市天气"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/hot-cities"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"hot-cities"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取最冷城市天气"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/cold-cities"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"cold-cities"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取特定温度范围内的城市"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/temperature-range?minTemp=25&amp;maxTemp=30"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"temperature-range"</span>],
          <span class="hljs-attr">"query"</span>: [
            {
              <span class="hljs-attr">"key"</span>: <span class="hljs-string">"minTemp"</span>,
              <span class="hljs-attr">"value"</span>: <span class="hljs-string">"25"</span>
            },
            {
              <span class="hljs-attr">"key"</span>: <span class="hljs-string">"maxTemp"</span>,
              <span class="hljs-attr">"value"</span>: <span class="hljs-string">"30"</span>
            }
          ]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取指定日期的天气预报"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/forecast/date/BJ?date=2025-06-07"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"forecast"</span>, <span class="hljs-string">"date"</span>, <span class="hljs-string">"BJ"</span>],
          <span class="hljs-attr">"query"</span>: [
            {
              <span class="hljs-attr">"key"</span>: <span class="hljs-string">"date"</span>,
              <span class="hljs-attr">"value"</span>: <span class="hljs-string">"2025-06-07"</span>
            }
          ]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"获取特定天气状况的城市"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"GET"</span>,
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/weather-condition/晴"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"weather-condition"</span>, <span class="hljs-string">"晴"</span>]
        }
      }
    },
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"比较多个城市的天气"</span>,
      <span class="hljs-attr">"request"</span>: {
        <span class="hljs-attr">"method"</span>: <span class="hljs-string">"POST"</span>,
        <span class="hljs-attr">"header"</span>: [
          {
            <span class="hljs-attr">"key"</span>: <span class="hljs-string">"Content-Type"</span>,
            <span class="hljs-attr">"value"</span>: <span class="hljs-string">"application/json"</span>
          }
        ],
        <span class="hljs-attr">"body"</span>: {
          <span class="hljs-attr">"mode"</span>: <span class="hljs-string">"raw"</span>,
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"[\"BJ\", \"SH\", \"GZ\"]"</span>
        },
        <span class="hljs-attr">"url"</span>: {
          <span class="hljs-attr">"raw"</span>: <span class="hljs-string">"http://localhost:9090/api/weather/compare"</span>,
          <span class="hljs-attr">"protocol"</span>: <span class="hljs-string">"http"</span>,
          <span class="hljs-attr">"host"</span>: [<span class="hljs-string">"localhost"</span>],
          <span class="hljs-attr">"port"</span>: <span class="hljs-string">"9090"</span>,
          <span class="hljs-attr">"path"</span>: [<span class="hljs-string">"api"</span>, <span class="hljs-string">"weather"</span>, <span class="hljs-string">"compare"</span>]
        }
      }
    }
  ]
}
</div></code></pre>
<ol start="2">
<li>
<p><strong>设置环境变量</strong>（可选）：</p>
<ul>
<li>点击右上角的齿轮图标，然后点击&quot;Add&quot;</li>
<li>创建一个新环境并命名为&quot;Weather Main Service API&quot;</li>
<li>添加变量<code>baseUrl</code>，值为<code>http://localhost:9090/api</code></li>
<li>点击&quot;Save&quot;保存环境</li>
</ul>
</li>
<li>
<p><strong>测试步骤</strong>：</p>
<ul>
<li>确保两个服务已启动：
<ul>
<li>mock-weather-api 服务监听在8081端口</li>
<li>weather-main-service 服务监听在9090端口</li>
</ul>
</li>
<li>依次点击每个接口进行测试</li>
<li>验证返回的JSON结构是否符合预期</li>
</ul>
</li>
</ol>
<h2 id="%E6%9C%8D%E5%8A%A1%E6%9E%B6%E6%9E%84%E8%AF%B4%E6%98%8E">服务架构说明</h2>
<p>Weather Main Service 是一个中间层服务，它通过WebClient调用mock-weather-api服务获取天气数据，并将数据转发给客户端。</p>
<p>服务架构如下：</p>
<pre class="hljs"><code><div>客户端 &lt;---&gt; Weather Main Service &lt;---&gt; Mock Weather API
           (端口: 9090)         (端口: 8081)
</div></code></pre>
<p>这种架构的优点：</p>
<ol>
<li>客户端不需要直接访问底层的Mock Weather API服务</li>
<li>Weather Main Service可以在未来添加缓存、安全控制、数据转换等功能</li>
<li>如果底层API发生变化，只需要修改Weather Main Service，客户端代码不需要改变</li>
</ol>
<h2 id="swagger-ui">Swagger UI</h2>
<p>您也可以通过Swagger UI界面来测试API：</p>
<ul>
<li>Swagger UI地址：<code>http://localhost:9090/api/swagger-ui/index.html</code></li>
</ul>
<p>通过Swagger UI，您可以：</p>
<ol>
<li>查看所有可用的API接口</li>
<li>了解每个接口的参数和返回类型</li>
<li>直接在浏览器中测试API调用</li>
</ol>
<h2 id="%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9">注意事项</h2>
<ol>
<li>确保Mock Weather API服务已经启动，否则Weather Main Service将无法获取数据</li>
<li>对于POST请求，请确保设置了正确的Content-Type为<code>application/json</code></li>
<li>所有时间相关的字段格式为<code>yyyy-MM-dd HH:mm:ss</code></li>
<li>所有日期相关的字段格式为<code>yyyy-MM-dd</code></li>
<li>错误响应会包含详细的错误信息，请检查返回的message字段</li>
</ol>

</body>
</html>
